package com.ulic.customerManApplication.usermodule.bo;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;


import com.ulic.customerManApplication.commonmodule.bo.BirthdayMessage;
import com.ulic.customerManApplication.commonmodule.bo.Organization;
import com.ulic.customerManApplication.documentmodule.bo.Document;
import com.ulic.customerManApplication.journeylovemodule.bo.JourneyOfLoveActivity;
import com.ulic.customerManApplication.mailmodule.bo.MailRecord;
import com.ulic.customerManApplication.memberenjoymodule.bo.MemberEnjoyActivity;
import com.ulic.customerManApplication.membermodule.bo.Member;
import com.ulic.customerManApplication.messagemodule.bo.MessageRecord;
import com.ulic.customerManApplication.studentmodule.bo.Student;

@Entity
@Table(name = "T_UM_USER")
@SequenceGenerator(name="user_seq",sequenceName="UM_USER_ID")
public class User {
	private String um_user_id;
	private String user_Name;//用户名
	private String password;//密码
	private String real_Name;//姓名
	private Date birthday;//生日
	private Character gender;//性别
	private Integer certi_type;//证件类型
	private String certi_no;//证件号码
	private Integer user_type;//用户类型
	private Character is_activie;//用户是否有效
	private String employee_number;//员工编号
	private String mail;//电子邮件
	private String mobile;//电话
	private String telephone;//办公电话
	private Character disable_cause;//用户失效原因
	private Date create_Date;//创建时间
	private Date update_Date;//更新时间
	private Organization organization;//所属组织机构
	
	private Set<BirthdayMessage> messages = new HashSet<BirthdayMessage>();//生日祝福语
	
	private Set<Document> documents = new HashSet<Document>();//上传文档
	
	private Set<JourneyOfLoveActivity> journeyOfLoveActivities = new HashSet<JourneyOfLoveActivity>();//爱心之旅
	
	private Set<MemberEnjoyActivity> memberEnjoyActivities = new HashSet<MemberEnjoyActivity>();//会员专享
	
	private Set<MailRecord> mails = new HashSet<MailRecord>();//邮件
	
	private Set<MessageRecord> messageRecords = new HashSet<MessageRecord>();//短信
	
	private Set<Member> members = new HashSet<Member>();//会员
	
	private Set<Student> students = new HashSet<Student>();//学生
	
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="user_seq")
	public String getUm_user_id() {
		return um_user_id;
	}

	public void setUm_user_id(String um_user_id) {
		this.um_user_id = um_user_id;
	}
	@Column(unique = true, nullable = false, updatable = true, length = 20)
	public String getUser_Name() {
		return user_Name;
	}

	public void setUser_Name(String user_Name) {
		this.user_Name = user_Name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getReal_Name() {
		return real_Name;
	}

	public void setReal_Name(String real_Name) {
		this.real_Name = real_Name;
	}

	public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public Character getGender() {
		return gender;
	}

	public void setGender(Character gender) {
		this.gender = gender;
	}

	public Integer getCerti_type() {
		return certi_type;
	}

	public void setCerti_type(Integer certiType) {
		certi_type = certiType;
	}

	public String getCerti_no() {
		return certi_no;
	}

	public void setCerti_no(String certi_no) {
		this.certi_no = certi_no;
	}

	public Integer getUser_type() {
		return user_type;
	}

	public void setUser_type(Integer userType) {
		user_type = userType;
	}

	public Character getIs_activie() {
		return is_activie;
	}

	public void setIs_activie(Character isActivie) {
		is_activie = isActivie;
	}

	public String getEmployee_number() {
		return employee_number;
	}

	public void setEmployee_number(String employee_number) {
		this.employee_number = employee_number;
	}

	public String getMail() {
		return mail;
	}

	public void setMail(String mail) {
		this.mail = mail;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}


	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public Character getDisable_cause() {
		return disable_cause;
	}

	public void setDisable_cause(Character disableCause) {
		disable_cause = disableCause;
	}

	public Date getCreate_Date() {
		return create_Date;
	}

	public void setCreate_Date(Date create_Date) {
		this.create_Date = create_Date;
	}

	public Date getUpdate_Date() {
		return update_Date;
	}

	public void setUpdate_Date(Date update_Date) {
		this.update_Date = update_Date;
	}

	@ManyToOne(cascade=CascadeType.REFRESH,fetch = FetchType.EAGER, optional = false)   
    @JoinColumn(name="UM_ORGAN")
	public Organization getOrganization() {
		return organization;
	}

	public void setOrganization(Organization organization) {
		this.organization = organization;
	}

	
	@OneToMany(targetEntity = BirthdayMessage.class, mappedBy = "user")
	public Set<BirthdayMessage> getMessages() {
		return messages;
	}

	public void setMessages(Set<BirthdayMessage> messages) {
		this.messages = messages;
	}
	@OneToMany(targetEntity = Document.class, mappedBy = "uploadPerson")
	public Set<Document> getDocuments() {
		return documents;
	}
	public void setDocuments(Set<Document> documents) {
		this.documents = documents;
	}
	@OneToMany(targetEntity = JourneyOfLoveActivity.class, mappedBy = "user")
	public Set<JourneyOfLoveActivity> getJourneyOfLoveActivities() {
		return journeyOfLoveActivities;
	}
	public void setJourneyOfLoveActivities(
			Set<JourneyOfLoveActivity> journeyOfLoveActivities) {
		this.journeyOfLoveActivities = journeyOfLoveActivities;
	}
	@OneToMany(targetEntity = MemberEnjoyActivity.class, mappedBy = "user")
	public Set<MemberEnjoyActivity> getMemberEnjoyActivities() {
		return memberEnjoyActivities;
	}
	public void setMemberEnjoyActivities(
			Set<MemberEnjoyActivity> memberEnjoyActivities) {
		this.memberEnjoyActivities = memberEnjoyActivities;
	}
	@OneToMany(targetEntity = MailRecord.class, mappedBy = "sender")
	public Set<MailRecord> getMails() {
		return mails;
	}
	public void setMails(Set<MailRecord> mails) {
		this.mails = mails;
	}
	@OneToMany(targetEntity = MessageRecord.class, mappedBy = "sender")
	public Set<MessageRecord> getMessageRecords() {
		return messageRecords;
	}
	public void setMessageRecords(Set<MessageRecord> messageRecords) {
		this.messageRecords = messageRecords;
	}
	@OneToMany(targetEntity = Member.class, mappedBy = "user")
	public Set<Member> getMembers() {
		return members;
	}
	public void setMembers(Set<Member> members) {
		this.members = members;
	}
	@OneToMany(targetEntity = Student.class, mappedBy = "user")
	public Set<Student> getStudents() {
		return students;
	}
	public void setStudents(Set<Student> students) {
		this.students = students;
	}
	
}
